package com.briup.estore.web.controller;


import com.briup.estore.Service.AddressService;
import com.briup.estore.vo.AddressVO;
import com.briup.estore.web.response.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@Api(tags = "地址模块")
@RequestMapping("/address")
public class AddressController {
    @Autowired
    private AddressService addressService;
    @GetMapping
    public Result list(HttpServletRequest request){
        String userId =(String) request.getAttribute("userId");
                //调用service查询当前用户的所有地址
        List<AddressVO> addressVO=addressService.list(userId);

        return Result.success(addressVO);
    }

}
